/**
 * 
 */

function openPhoto(num){
	var width = $(window).innerWidth();
	var height = $(window).innerHeight();
	
	$('#photoViewMain').css('left', (width/2 - 1024/2)+'px');
	$('#photoViewMain').css('top', (height/2 - 600/2)+'px');
	
	var photoHeight = parseInt($('div.photoView img').css('height'));
	var photoWidth = parseInt($('div.photoView img').css('width'));
	
	if(photoHeight > photoWidth) {
		$('div.photoView img').css('margin-left', (300-photoWidth/2)+'px');
	}
	else if(photoWidth > photoHeight) {
		$('div.photoView img').css('margin-top', (300-photoHeight/2)+'px');
	}
	$('#back').addClass('background');
	$('#photoViewMain').css('visibility', 'visible');
	$('body, html').css('overflow', 'hidden');
	
	$('#back').on('click', function(){
		$('body, html').css('overflow', 'auto');
		$('#photoViewMain').css('visibility', 'hidden');
		$('#back').removeClass('background');
		$('#back').off('click');
	});
}